package com.plian.system.wrapper.qg.guarantee;

import com.plian.system.dto.qg.guarantee.PropertyGuaranteeExecuteDTO;
import com.plian.system.entity.qg.guarantee.PropertyGuaranteeExecute;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.qg.guarantee.PropertyGuaranteeExecuteVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 企业担保执行主表包装类,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-10-24
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class})
public interface PropertyGuaranteeExecuteWrapper extends BaseWrapper<PropertyGuaranteeExecute, PropertyGuaranteeExecuteDTO, PropertyGuaranteeExecuteVO> {

	/**
	 * Entity转VO
	 *
	 * @param entity /
	 * @return /
	 */
	@Override
	@Mappings(value = {
			@Mapping(source = "applyNameId", target = "applyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "guaranteeCompanyId", target = "guaranteeCompanyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "guaranteeModeId", target = "guaranteeModeName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "guaranteeDutyId", target = "guaranteeDutyName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "loanTypeId", target = "loanTypeName", qualifiedByName = DICT_CODE_LIST_TO_NAME),
			@Mapping(source = "loanNatureId", target = "loanNatureName", qualifiedByName = DICT_CODE_LIST_TO_NAME)
	})
	PropertyGuaranteeExecuteVO entityToVO(PropertyGuaranteeExecute entity);
}
